cmake_minimum_required(VERSION 3.0.0)
project(voice-assistant VERSION 0.1.0 LANGUAGES C)

# 包含头文件目录
include_directories(include)

# 创建record库
add_library(record_lib src/record.c)
target_link_libraries(record_lib asound pthread)

# 创建control库
add_library(control_lib src/control.c)
target_link_libraries(control_lib asound)

# 创建key_common库
add_library(key_common_lib src/key_common.c)
target_link_libraries(key_common_lib gpiod)

# 创建key1库
add_library(key1_lib src/key1.c)
target_link_libraries(key1_lib record_lib key_common_lib)

# 创建key2库
add_library(key2_lib src/key2.c)
target_link_libraries(key2_lib control_lib key_common_lib)

# 创建key3库
add_library(key3_lib src/key3.c)
target_link_libraries(key3_lib control_lib key_common_lib)

# 编译main.c并链接所有必要的库
add_executable(main src/main.c)
target_link_libraries(main key1_lib key2_lib key3_lib)
